package com.abner.activiti.query;


import org.activiti.engine.HistoryService;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.history.HistoricActivityInstanceQuery;

import java.util.List;

/**
 * @description:
 * @author: guoc
 * @createDate: 2020/9/11 16:03
 */
public class QuartHistoric {


    public void getActivitiHistoric(){
        ProcessEngine defaultProcessEngine = ProcessEngines.getDefaultProcessEngine();
        HistoryService historyService = defaultProcessEngine.getHistoryService();
        HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
        //过滤查询，流程实例ID 数据表中act_hi_actinst【PROC_INST_ID_】
        HistoricActivityInstanceQuery historicActivityInstanceQuery = query.processInstanceId("25001");

        List<HistoricActivityInstance> list = historicActivityInstanceQuery.list();
        for (HistoricActivityInstance historicActivityInstance : list) {
            System.out.println(historicActivityInstance.getActivityId());
            System.out.println(historicActivityInstance.getActivityName());
            System.out.println(historicActivityInstance.getAssignee());
            System.out.println("=======================================");
        }
    }

    public static void main(String[] args) {
        QuartHistoric quartHistoric=new QuartHistoric();
        quartHistoric.getActivitiHistoric();
    }

}
